package nio.socket.block;

/**
 * 缺点：client2请求要等待client1请求连接处理完才会被处理，而client1连接可能会进行多次数据请求交互
 */
public class BlockServerTest {
    private static int port = 9999;
    private static String host = "127.0.0.1";

    public static void main(String[] args) throws InterruptedException {
        new Thread(()->{
            BlockServer.start(port);
        },"server").start();

        Thread.sleep(1000);

        new Thread(()->{
            Client.post(host,port,3000);
        },"client1").start();

        new Thread(()->{
            Client.post(host,port,3000);
        },"client2").start();

        Thread.sleep(1000);
    }
}
